/**
 * 列表状态/按钮
 */
export const commonOperates = {
  assign: {
    label: "分配",
    fn: data => {
      console.log("分配", data);
    }
  },
  confirmStart: {
    label: "开工确认",
    fn: data => {
      console.log("开工确认", data);
    }
  },
  resetTask: {
    label: "重置任务",
    fn: data => {
      console.log("重置任务", data);
    }
  },
  initiateChange: {
    label: "发起增减项",
    fn: data => {
      console.log("发起增减项", data);
    }
  },
  adjustPlan: {
    label: "调整计划",
    fn: data => {
      console.log("调整计划", data);
    }
  },
  initiateRectification: {
    label: "发起整改",
    fn: data => {
      console.log("发起整改", data);
    }
  },
  applyShutdown: {
    label: "停工申请",
    fn: data => {
      console.log("停工申请", data);
    }
  },
  resumeWork: {
    label: "复工",
    fn: data => {
      console.log("复工", data);
    }
  },
  cancelShutdown: {
    label: "取消停工申请",
    fn: data => {
      console.log("取消停工申请", data);
    }
  },
  applyFinalSettlement: {
    label: "申请决算",
    fn: data => {
      console.log("申请决算", data);
    }
  }
};

export const constructionStatus = new Map([
  [
    "not_start",
    {
      label: "未开始",
      operates: [commonOperates.assign, commonOperates.confirmStart, commonOperates.resetTask, commonOperates.initiateChange]
    }
  ],
  [
    "ing",
    {
      label: "进行中",
      operates: [
        commonOperates.assign,
        commonOperates.adjustPlan,
        commonOperates.resetTask,
        commonOperates.initiateRectification,
        commonOperates.initiateChange,
        commonOperates.applyShutdown
      ]
    }
  ],
  [
    "shutdown",
    {
      label: "已停工",
      operates: [commonOperates.assign, commonOperates.resumeWork]
    }
  ],
  [
    "shutdown_ing",
    {
      label: "停工审核中",
      operates: [
        commonOperates.assign,
        commonOperates.adjustPlan,
        commonOperates.resetTask,
        commonOperates.initiateRectification,
        commonOperates.initiateChange,
        commonOperates.cancelShutdown
      ]
    }
  ],
  [
    "complete",
    {
      label: "已交付",
      operates: [commonOperates.applyFinalSettlement, commonOperates.initiateRectification, commonOperates.initiateChange]
    }
  ],
  [
    "time_out",
    {
      label: "已超期",
      operates: []
    }
  ],
  [
    "delay_risk",
    {
      label: "延期风险",
      operates: []
    }
  ]
]);
